//
//  SISSUploadEntrustContractShowViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2019/7/3.
//  Copyright © 2019 优房网. All rights reserved.
//

#import "SISSUploadEntrustContractShowViewController.h"
#import "SISSShowView.h"
#import "SISSUploadImageShowView.h"
#import "SISSUploadEntrustContractViewController.h"

@interface SISSUploadEntrustContractShowViewController ()

/// 合同编号
@property (weak, nonatomic) SISSShowView *contractNoView;
/// 备注
@property (weak, nonatomic) SISSShowView *remarkView;
/// 合同截止日期
@property (weak, nonatomic) SISSShowView *contractEndDateView;
/// 备注
@property (weak, nonatomic) SISSShowView *createDateView;

@property (weak, nonatomic) SISSUploadImageShowView *uploadImageShowView;

@property (weak, nonatomic) UIButton *modifyButton;

@end

@implementation SISSUploadEntrustContractShowViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"委托合同详情";
    
    [self requestData];
}

- (void)requestData {
    
    self.contractNoView.rightStr = @"34567";
    
    self.uploadImageShowView.imageUrlArr = @[@"http://fslab.ufwl.net/group1/M00/00/04/CgIBW10IipKAXC9wAAD5_xZ_lUg960.jpg"].mutableCopy;
}

#pragma mark - 按钮点击事件
- (void)modifyButtonClickAction {
    SISSUploadEntrustContractViewController *vc = [[SISSUploadEntrustContractViewController alloc] init];
    vc.imgUrlArr = self.uploadImageShowView.imageUrlArr;
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - UI
- (void)setupSubviews {
    
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    SISSShowView *contractNoView = [[SISSShowView alloc] init];
    contractNoView.isShowBottomLine = YES;
    contractNoView.leftStr = @"合同编号";
    contractNoView.rightStr = @"";
    [self.view addSubview:contractNoView];
    self.contractNoView = contractNoView;
    
    SISSShowView *remarkView = [[SISSShowView alloc] init];
    remarkView.isShowBottomLine = YES;
    remarkView.leftStr = @"备注";
    [self.view addSubview:remarkView];
    self.remarkView = remarkView;
    
    SISSShowView *contractEndDateView = [[SISSShowView alloc] init];
    contractEndDateView.isShowBottomLine = YES;
    contractEndDateView.leftStr = @"合同截止日期";
    contractEndDateView.rightStr = @"";
    [self.view addSubview:contractEndDateView];
    self.contractEndDateView = contractEndDateView;
    
    SISSShowView *createDateView = [[SISSShowView alloc] init];
    createDateView.isShowBottomLine = YES;
    createDateView.leftStr = @"创建时间";
    createDateView.rightStr = @"";
    [self.view addSubview:createDateView];
    self.createDateView = createDateView;
    
    SISSUploadImageShowView *uploadImageShowView = [[SISSUploadImageShowView alloc] init];
    [self.view addSubview:uploadImageShowView];
    self.uploadImageShowView = uploadImageShowView;
    
    UIButton *modifyButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [modifyButton setTitle:@"变更" forState:UIControlStateNormal];
    [modifyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [modifyButton setBackgroundColor:COLOR(0x60C8AB)];
    [modifyButton addTarget:self action:@selector(modifyButtonClickAction) forControlEvents:UIControlEventTouchUpInside];
    modifyButton.layer.cornerRadius = 4;
    modifyButton.layer.masksToBounds = YES;
    [self.view addSubview:modifyButton];
    self.modifyButton = modifyButton;
}

#pragma mark - 约束
- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGSize buttonSize = CGSizeMake(SCREEN_WIDTH * 0.8, 54);
    [self.contractNoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.mas_topLayoutGuideBottom).offset(globelMargin);
        make.left.right.equalTo(weakSelf.view);
        make.height.mas_equalTo(5.5 * globelMargin);
    }];
    
    [self.remarkView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.contractNoView.mas_bottom);
        make.left.right.equalTo(weakSelf.view);
        make.height.mas_equalTo(5.5 * globelMargin);
    }];
    
    [self.contractEndDateView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.remarkView.mas_bottom);
        make.left.right.equalTo(weakSelf.view);
        make.height.mas_equalTo(5.5 * globelMargin);
    }];
    
    [self.createDateView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.contractEndDateView.mas_bottom);
        make.left.right.equalTo(weakSelf.view);
        make.height.mas_equalTo(5.5 * globelMargin);
    }];
    
    [self.uploadImageShowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.createDateView.mas_bottom).offset(5.5 * globelMargin);
        make.left.right.equalTo(weakSelf.view);
    }];
    
    [self.modifyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.uploadImageShowView.mas_bottom).offset(6 * globelMargin);
        make.centerX.equalTo(weakSelf.view.mas_centerX);
        make.size.mas_equalTo(buttonSize);
    }];
    
}

@end
